home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / role / pinfocom_3_0.lha / Source / amiga_data.c < prev    next >
C/C++ Source or Header  |  1992-10-22  |  11KB  |  511 lines

  1. /* amiga_data.c
  2.  *
  3.  *  ``pinfocom'' -- a portable Infocom Inc. data file interpreter.
  4.  *  Copyright (C) 1987-1992  InfoTaskForce
  5.  *
  6.  *  This program is free software; you can redistribute it and/or modify
  7.  *  it under the terms of the GNU General Public License as published by
  8.  *  the Free Software Foundation; either version 2 of the License, or
  9.  *  (at your option) any later version.
  10.  *
  11.  *  This program is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *  GNU General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU General Public License
  17.  *  along with this program; see the file COPYING.  If not, write to the
  18.  *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. /*
  22.  * $Header: RCS/amiga_data.c,v 3.0 1992/10/21 16:56:19 pds Stab $
  23.  */
  24.  
  25. #ifndef _AMIGA_GLOBAL_H
  26.  
  27. #define _AMIGA_DATA_C
  28. #include "amiga_global.h"
  29.  
  30. #endif    /* !_AMIGA_GLOBAL_H */
  31.  
  32.     /* Clipboard support data. */
  33.  
  34. struct IFFHandle    *ClipHandle;
  35.  
  36. STRPTR             ClipBuffer,
  37.              ClipIndex;
  38.  
  39. LONG             ClipSize,
  40.              ClipLength;
  41.  
  42. Bool             ClipInput;
  43.  
  44.     /* Version identifier. */
  45.  
  46. STATIC STRPTR         VersionTag = VERSION_STRING;
  47.  
  48.     /* Global library pointers, don't touch! */
  49.  
  50. struct IntuitionBase    *IntuitionBase;
  51. struct GfxBase        *GfxBase;
  52.  
  53. struct Library        *WorkbenchBase,
  54.             *DiskfontBase,
  55.             *IFFParseBase,
  56.             *GadToolsBase,
  57.             *UtilityBase,
  58.             *IconBase,
  59.             *AslBase;
  60.  
  61. struct Device        *ConsoleDevice;
  62.  
  63.     /* Workbench startup message. */
  64.  
  65. struct WBStartup    *WBenchMsg;
  66.  
  67.     /* Screen and window data. */
  68.  
  69. struct Window        *Window;
  70. struct Menu        *Menu;
  71. struct RastPort        *RPort;
  72.  
  73. struct Screen        *DefaultScreen,
  74.             *Screen;
  75. APTR             VisualInfo;
  76. UBYTE             Depth;
  77.  
  78.     /* Default window title. */
  79.  
  80. TEXT             WindowTitle[AMIGADOS_NAME_LIMIT + 1];
  81.  
  82.     /* Global flags. */
  83.  
  84. Bool             UseCustomScreen,
  85.              WindowIsActive,
  86.              LibsOpened,
  87.              NewOS;
  88.  
  89.     /* Console IO data. */
  90.  
  91. struct IOStdReq        *ConRequest;
  92. struct InputEvent    *InputEvent;
  93. STRPTR             InputEventBuffer;
  94.  
  95. LONG             CursorX,
  96.              CursorY,
  97.              SpaceWidth,
  98.              LastCursorX,
  99.              LastCursorY,
  100.              OldCursorWidth,
  101.              NewCursorWidth,
  102.              DefaultCursorWidth;
  103.  
  104. int             MenuLockCount;
  105.  
  106. Bool             RedrawInputLine,
  107.              CursorEnabled;
  108.  
  109.     /* Process and window tricks. */
  110.  
  111. struct Process        *ThisProcess;
  112. APTR             WindowPtr;
  113.  
  114.     /* Timer data. */
  115.  
  116. struct MsgPort        *TimePort;
  117. struct timerequest    *TimeRequest;
  118.  
  119.     /* Workbench appwindow support. */
  120.  
  121. struct MsgPort        *WorkbenchPort;
  122. struct AppWindow    *WorkbenchWindow;
  123.  
  124.     /* The name of the project to restore. */
  125.  
  126. TEXT             ProjectName[MAX_FILENAME_LENGTH];
  127.  
  128.     /* A temporary string buffer. */
  129.  
  130. TEXT             TempBuffer[BUFFER_LENGTH];
  131.  
  132.     /* Story file name. */
  133.  
  134. char            *StoryName;
  135.  
  136.     /* Story serial number. */
  137.  
  138. ULONG             StorySerial    = 0,
  139.              StoryRelease    = 0,
  140.              StoryIndex    = 0;
  141.  
  142.     /* Default story file name and file
  143.      * extension.
  144.      */
  145.  
  146. char            *StoryNames[]        = {FNAME_LST,NULL},
  147.             *StoryExtensions[]    = {"",FEXT_LST,NULL};
  148.  
  149.     /* Two different fonts. */
  150.  
  151. struct TextFont        *PropFont,
  152.             *FixedFont,
  153.             *ThisFont;
  154.  
  155.     /* Disk font support. */
  156.  
  157. struct TextFont        *ListFont,
  158.             *TextFont;
  159.  
  160. TEXT             ListFontName[MAXFONTPATH],
  161.              TextFontName[MAXFONTPATH];
  162.  
  163. LONG             FontSize;
  164.  
  165. struct TextAttr         ListFontAttr,
  166.              TextFontAttr;
  167.  
  168.     /* Text font dimensions. */
  169.  
  170. UWORD             TextFontWidth,
  171.              TextFontHeight;
  172.  
  173.     /* Window dimensions. */
  174.  
  175. WORD             WindowWidth,
  176.              OldWindowWidth,
  177.              OldWindowHeight;
  178.  
  179.     /* Screen characteristics. */
  180.  
  181. LONG             ConNumLines,
  182.              ConLinesPrinted,
  183.              ConLineContext,
  184.              ConLineIndent,
  185.              ConLineMargin;
  186.  
  187.     /* Text and background pens. */
  188.  
  189. LONG             ConTextPen = 1,
  190.              ConBackPen = 0;
  191.  
  192.     /* Fixed status window support. */
  193.  
  194. LONG             ConNumStatusLines    = 1;
  195. int             ConOutputWindow    = 0;
  196.  
  197.     /* History management. */
  198.  
  199. struct StringBuffer     HistoryBuffer[HISTORY_LINES];
  200. int             LastHistory = -1;
  201.  
  202.     /* Function key support. */
  203.  
  204. struct StringBuffer     FunctionKeys[NUM_FKEYS];
  205.  
  206.     /* Fake input buffer. */
  207.  
  208. TEXT             InputBuffer[INPUT_LENGTH];
  209. STRPTR             InputIndex;
  210.  
  211.     /* Data to be located in chip-memory. */
  212.  
  213. UWORD            *ChipData;
  214.  
  215.     /* Pull-down menu definitions. */
  216.  
  217. struct NewMenu ConMenuConfig[NUM_MENUS] =
  218. {
  219.     {NM_TITLE, "Project",                     0 ,NULL,    0,NULL},
  220.     { NM_ITEM, "About...",                    "?",NULL,    0,NULL},
  221.     { NM_ITEM, NM_BARLABEL,                     0 ,NULL,    0,NULL},
  222.     { NM_ITEM, "Save as...",                "A",NULL,    0,"Save\r"},
  223.     { NM_ITEM, "Open...",                    "O",NULL,    0,"Restore\r"},
  224.     { NM_ITEM, NM_BARLABEL,                     0 ,NULL,    0,NULL},
  225.     { NM_ITEM, "Script...",                    "P",MENU_TICK,    0,NULL},
  226.     { NM_ITEM, NM_BARLABEL,                     0 ,NULL,    0,NULL},
  227.     { NM_ITEM, "Restart...",                "R",NULL,    0,"Restart\r"},
  228.     { NM_ITEM, NM_BARLABEL,                     0 ,NULL,    0,NULL},
  229.     { NM_ITEM, "Quit...",                    "Q",NULL,    0,"Quit\r"},
  230.  
  231.     {NM_TITLE, "Edit",                     0 ,NULL,    0,NULL},
  232.     { NM_ITEM, "Cut",                    "X",NULL,    0,NULL},
  233.     { NM_ITEM, "Copy",                    "C",NULL,    0,NULL},
  234.     { NM_ITEM, "Paste",                    "V",NULL,    0,NULL},
  235.     { NM_ITEM, NM_BARLABEL,                     0 ,NULL,    0,NULL},
  236.     { NM_ITEM, "Undo",                    "Z",NULL,    0,NULL},
  237.  
  238.     {NM_TITLE, "Commands",                     0 ,NULL,    0,NULL},
  239.     { NM_ITEM, "Look",                    "L",NULL,    0,"Look\r"},
  240.     { NM_ITEM, "Inventory",                    "I",NULL,    0,"Inventory\r"},
  241.     { NM_ITEM, NM_BARLABEL,                     0 ,NULL,    0,NULL},
  242.     { NM_ITEM, "Diagnose",                    "D",NULL,    0,"Diagnose\r"},
  243.     { NM_ITEM, "Score",                    "S",NULL,    0,"Score\r"},
  244.     { NM_ITEM, "Time",                    "T",NULL,    0,"Time\r"},
  245.     { NM_ITEM, NM_BARLABEL,                     0 ,NULL,    0,NULL},
  246.     { NM_ITEM, "Wait",                    "W",NULL,    0,"Wait\r"},
  247.     { NM_ITEM, "Again",                    "G",NULL,    0,"Again\r"},
  248.  
  249.     {NM_TITLE, "Story",                     0 ,NULL,    0,NULL},
  250.     { NM_ITEM, "Superbrief",                "<",NULL,    0,"Superbrief\r"},
  251.     { NM_ITEM, "Brief",                    ".",NULL,    0,"Brief\r"},
  252.     { NM_ITEM, "Verbose",                    ">",NULL,    0,"Verbose\r"},
  253.  
  254.     {NM_TITLE, "Options",                     0 ,NULL,    0,NULL},
  255.     { NM_ITEM, "Display object attribute assignments",    "1",MENU_TICK,    0,"@attr\r"},
  256.     { NM_ITEM, "Display object attribute tests",        "2",MENU_TICK,    0,"@atest\r"},
  257.     { NM_ITEM, "Echo input",                "3",MENU_TICK,    0,"@echo\r"},
  258.     { NM_ITEM, "Page text output",                "4",MENU_TICK,    0,"@pager\r"},
  259.     { NM_ITEM, "Display alternate prompt",            "5",MENU_TICK,    0,"@prompt\r"},
  260.     { NM_ITEM, "Display status line",            "6",MENU_TICK,    0,"@status\r"},
  261.     { NM_ITEM, "Display tandy license",            "7",MENU_TICK,    0,"@tandy\r"},
  262.     { NM_ITEM, "Display object transfers",            "8",MENU_TICK,    0,"@xfers\r"},
  263.     { NM_ITEM, NM_BARLABEL,                     0 ,NULL,    0,NULL},
  264.     { NM_ITEM, "List available options",            "!",NULL,    0,"@\r"},
  265.  
  266.     {NM_END,   NULL,                     0 ,NULL,    0,NULL}
  267. };
  268.  
  269.     /* Stopwatch mouse pointer data. */
  270.  
  271. UWORD StopwatchData[(1 + STOPWATCH_HEIGHT + 1) * 2] =
  272. {
  273.     0x0000,0x0000,
  274.  
  275.     0x0400,0x07C0,
  276.     0x0000,0x07C0,
  277.     0x0100,0x0380,
  278.     0x0000,0x07E0,
  279.     0x07C0,0x1FF8,
  280.     0x1FF0,0x3FEC,
  281.     0x3FF8,0x7FDE,
  282.     0x3FF8,0x7FBE,
  283.     0x7FFC,0xFF7F,
  284.     0x7EFC,0xFFFF,
  285.     0x7FFC,0xFFFF,
  286.     0x3FF8,0x7FFE,
  287.     0x3FF8,0x7FFE,
  288.     0x1FF0,0x3FFC,
  289.     0x07C0,0x1FF8,
  290.     0x0000,0x07E0,
  291.  
  292.     0x0000,0x0000
  293. };
  294.  
  295.     /* File requester support. */
  296.  
  297. struct FileRequester    *GameFileRequest;
  298.  
  299.     /* Game file release and serial numbers. */
  300.  
  301. LONG SerialNumbers[][3] =
  302. {
  303.     0,    97,    851218,    /* Ballyhoo */
  304.  
  305.     1,    23,    840809,    /* Cutthroats */
  306.  
  307.     2,    26,    821108,    /* Deadline */
  308.     2,    27,    831005,
  309.  
  310.     3,    10,    830810,    /* Enchanter */
  311.     3,    16,    831118,
  312.     3,    24,    851118,
  313.     3,    29,    860820,
  314.  
  315.     4,    37,    861215,    /* Hollywood Hijinx */
  316.  
  317.     5,    22,    830916,    /* Infidel */
  318.  
  319.     6,    118,    860325,    /* Leather Goddesses of Phobos */
  320.     6,    50,    860711,
  321.     6,    59,    860730,
  322.  
  323.     7,    4,    860918,    /* Moonmist */
  324.     7,    9,    861022,
  325.  
  326.     8,    20,    830708,    /* Planetfall */
  327.     8,    29,    840118,
  328.     8,    37,    851003,
  329.  
  330.     9,    26,    870730,    /* Plundered Hearts */
  331.  
  332.     10,    15,    840501,    /* Seastalker */
  333.     10,    15,    840522,
  334.     10,    16,    850515,
  335.     10,    16,    850603,
  336.  
  337.     11,    4,    840131,    /* Sorcerer */
  338.     11,    6,    840508,
  339.     11,    13,    851021,
  340.     11,    15,    851108,
  341.  
  342.     12,    63,    850916,    /* Spellbreaker */
  343.     12,    87,    860904,
  344.  
  345.     13,    15,    820901,    /* Starcross */
  346.     13,    17,    821021,
  347.  
  348.     14,    107,    870430,    /* Stationfall */
  349.  
  350.     15,    14,    841005,    /* Suspect */
  351.  
  352.     16,    7,    830419,    /* Suspended */
  353.     16,    8,    830521,
  354.     16,    8,    840521,
  355.  
  356.     17,    47,    840914,    /* The Hitchhiker's Guide to the Galaxy */
  357.     17,    56,    841221,
  358.     17,    58,    851002,
  359.     17,    59,    851108,
  360.  
  361.     18,    203,    870506,    /* The lurking Horror */
  362.     18,    219,    870912,
  363.     18,    221,    870918,
  364.  
  365.     19,    20,    831119,    /* The Witness */
  366.     19,    21,    831208,
  367.     19,    22,    840924,
  368.  
  369.     20,    68,    850501,    /* Wishbringer: The Magick Stone of Dreams */
  370.     20,    69,    850920,
  371.  
  372.     21,    28,    821013,    /* Zork I: The Great Underground Empire */
  373.     21,    30,    830330,
  374.     21,    75,    830929,
  375.     21,    76,    840509,
  376.     21,    88,    840726,
  377.  
  378.     22,    18,    820517,    /* Zork II: The Wizard of Frobozz */
  379.     22,    22,    830331,
  380.     22,    48,    840904,
  381.  
  382.     23,    15,    830331,    /* Zork III: The Dungeon Master */
  383.     23,    15,    840518,
  384.     23,    17,    840727,
  385.  
  386.     -1,    0,    0    /* Terminator (not an Infocom game!) */
  387. };
  388.  
  389.     /* Type 3 game titles. */
  390.  
  391. char *Titles[NUM_GAMES] =
  392. {
  393.     "Ballyhoo",
  394.     "Cutthroats",
  395.     "Deadline",
  396.     "Enchanter",
  397.     "Hollywood Hijinx",
  398.     "Infidel",
  399.     "Leather Goddesses of Phobos",
  400.     "Moonmist",
  401.     "Planetfall",
  402.     "Plundered Hearts",
  403.     "Seastalker",
  404.     "Sorcerer",
  405.     "Spellbreaker",
  406.     "Starcross",
  407.     "Stationfall",
  408.     "Suspect",
  409.     "Suspended",
  410.     "The Hitchhiker's Guide to the Galaxy",
  411.     "The Lurking Horror",
  412.     "The Witness",
  413.     "Wishbringer: The Magick Stone of Dreams",
  414.     "Zork I: The Great Underground Empire",
  415.     "Zork II: The Wizard of Frobozz",
  416.     "Zork III: The Dungeon Master"
  417. };
  418.  
  419.     /* Type 3 game authors. */
  420.  
  421. char *Authors[NUM_GAMES] =
  422. {
  423.     "Jeff O'Neill",
  424.     "Michael Berlyn and Jerry Wolper",
  425.     "Marc Blank",
  426.     "Marc Blank and Dave Lebling",
  427.     "Dave Anderson",
  428.     "Michael Berlyn",
  429.     "Steve Meretzky",
  430.     "Stu Galley and Jim Lawrence",
  431.     "Steve Meretzky",
  432.     "Amy Briggs",
  433.     "Stu Galley and Jim Lawrence",
  434.     "Steve Meretzky",
  435.     "Dave Lebling",
  436.     "Dave Lebling",
  437.     "Steve Meretzky",
  438.     "Dave Lebling",
  439.     "Michael Berlyn",
  440.     "Douglas Adams and Steve Meretzky",
  441.     "Dave Lebling",
  442.     "Stu Galley",
  443.     "Brian Moriarty",
  444.     "Marc Blank and Dave Lebling",
  445.     "Marc Blank and Dave Lebling",
  446.     "Marc Blank and Dave Lebling"
  447. };
  448.  
  449.     /* Type 3 game levels. */
  450.  
  451. int GameLevels[NUM_GAMES] =
  452. {
  453.     LEVEL_STANDARD,
  454.     LEVEL_STANDARD,
  455.     LEVEL_EXPERT,
  456.     LEVEL_STANDARD,
  457.     LEVEL_STANDARD,
  458.     LEVEL_ADVANCED,
  459.     LEVEL_STANDARD,
  460.     LEVEL_INTRODUCTORY,
  461.     LEVEL_STANDARD,
  462.     LEVEL_STANDARD,
  463.     LEVEL_INTRODUCTORY,
  464.     LEVEL_ADVANCED,
  465.     LEVEL_EXPERT,
  466.     LEVEL_EXPERT,
  467.     LEVEL_STANDARD,
  468.     LEVEL_ADVANCED,
  469.     LEVEL_EXPERT,
  470.     LEVEL_STANDARD,
  471.     LEVEL_STANDARD,
  472.     LEVEL_STANDARD,
  473.     LEVEL_INTRODUCTORY,
  474.     LEVEL_STANDARD,
  475.     LEVEL_ADVANCED,
  476.     LEVEL_ADVANCED
  477. };
  478.  
  479. char *Levels[LEVEL_EXPERT + 1] =
  480. {
  481.     "introductory level",
  482.     "standard level",
  483.     "advanced level",
  484.     "expert level"
  485. };
  486.  
  487.     /* Transcript file support. */
  488.  
  489. FILE            *ScriptFile;
  490. TEXT             ScriptFileName[MAX_FILENAME_LENGTH];
  491. int             ScriptWidth;
  492. Bool             ScriptAborted;
  493.  
  494.     /* Sound support. */
  495.  
  496. struct IOAudio        *SoundRequestLeft,
  497.             *SoundRequestRight,
  498.             *SoundControlRequest;
  499. struct MsgPort        *SoundPort;
  500.  
  501.     /* Sound file search path. */
  502.  
  503. char            *SoundName,
  504.             *SoundPath;
  505.  
  506.     /* Sound file data. */
  507.  
  508. int             SoundNumber = -1;
  509. APTR             SoundData;
  510. LONG             SoundLength;
  511.